package com.ai.test.service;

import com.ai.test.dao.ConsumerMapper;
import com.ai.test.model.Consumer;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * Date:  2018/11/5
 * Time:  13:25
 * Email: siy@hmgsoft.com
 * Created by siy
 */
@Service("consumerServiceCancel")
public class ConsumerServiceCancel implements ConsumerService {
	@Resource
	private ConsumerMapper consumerMapper;

	@Transactional
	@Override
	public void increaseAmount(String id, int amount) {
		Consumer consumer = consumerMapper.selectByPrimaryKey(id);
		consumer.setTCount(consumer.getTCount()-amount);
		consumerMapper.updateByPrimaryKeySelective(consumer);
	}
}
